package cn.shujuhai.common.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 菜单表
 *
 * @TableName sys_menu
 */
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_menu")
@Data
public class SysMenu extends BaseDomain {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Long menuId;

    /**
     * 菜单名
     */
    @NotNull(message = "菜单名称不能为空")
    @Size(max = 10, min = 1, message = "菜单名称长度最大为10")
    @Pattern(regexp = "^[a-zA-Z\\u4e00-\\u9fa5][a-zA-Z0-9\\u4e00-\\u9fa5\\s]*$", message = "栏目名称不能包含特殊字符")
    private String title;

    /**
     * 菜单排序
     */
    @NotNull(message = "菜单排序号不能为空")
    private Long menuSort;

    /**
     * 父级菜单
     */
    private Long parentId;

    /**
     * 菜单路径
     */
    private String href;
    /**
     * 菜单图标
     */
    private String icon;
    /**
     * 描述
     */
    private String description;
    /**
     * 描述
     */
    @NotNull(message = "菜单类型不能为空")
    private Long type;
    /**
     * 禁用状态
     */
    private Integer status;
    @TableField(exist = false)
    private List<SysMenu> children;
    @TableField(exist = false)
    private String id;
    @TableField(exist = false)
    private List<Long> permissionIds;
}